home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10701 < prev    next >
Encoding:
Text File  |  1996-08-05  |  958 b   |  49 lines

  1. Path: netnews.whoi.edu!inn
  2. From: Mark Hill <mhill>
  3. Newsgroups: comp.lang.c
  4. Subject: Pointer swapping
  5. Date: 19 Mar 1996 15:24:13 GMT
  6. Organization: Woods Hole Oceanographic Institution
  7. Message-ID: <4imjit$oil@pearl.whoi.edu>
  8. NNTP-Posting-Host: gause.whoi.edu
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.1N (X11; I; SunOS 4.1.3_U1 sun4m)
  13. X-URL: news:comp.lang.c
  14.  
  15. I have two int huge arrays with a pointer to each which I use to access and
  16. assign values. After assigning values to one of the arrays I want to swap
  17. pointers between the two arrays. 
  18.  
  19. int huge A;
  20. int huge B;
  21. int huge *prtA;
  22. int huge *prtB;
  23.  
  24. main()
  25.    {
  26.     int ct = 0;
  27.     do
  28.     {
  29.     int huge prtA = A;
  30.         int huge ptrB = B;
  31.     .
  32.     .
  33.     .
  34.     .
  35.          if (ct % 2 ==0 )
  36.             {
  37.        ptrA = B;
  38.        ptrB = A;
  39.        }
  40.     else
  41.        {
  42.        ptrA = A;
  43.        ptrB = B;
  44.        }
  45.    }while
  46.  
  47. Information seems to be loss when I do this . Shouldn't this work?
  48.  
  49.